product_list =[
    ('华为P30',3800),
    ('Mac Pro',16000),
    ('milk tea',15),
    ('Crabs',88),
    ('Bikes',800),
    ('Watch',100000),
    ('Book',100)
    ]
shopping_car = []

zhifubao = input("输入Alipay余额")
if zhifubao.isdigit():
        zhifubao = int(zhifubao)
        while True:
            for item in product_list:
                print(product_list.index(item),item)
            choice = input("输入商品名编号")
            if choice.isdigit():
                choice = int(choice)
                if choice >=0 and choice <8:
                    if zhifubao >= product_list[choice][1]:
                        zhifubao = zhifubao - product_list[choice][1]
                        shopping_car.append(product_list[choice])
                        print("成功把商品%s添加到购物车，支付宝余额是%s:"%(product_list[choice][0],zhifubao))
                    else:
                        print("余额不足，请重新选择商品")
                        print("余额：",zhifubao)
                        print(shopping_car)
                else:
                    print("商品列表没有这个商品")
            elif choice =='Q':
                print(zhifubao)
                print(shopping_car)
        else:
            print("按Q退出")
else:
    print("重新输入数字")
